<template>
    <div class="index-page">
        <div class="header">
            <div class="header-section">
                <img class="logo" src="@/assets/images/index/logo.png" alt="">
                <div class="title">航班天气因素上座情况预测分析软件</div>
                <div class="menu-list">
                    <div class="menu-item active">
                        <img src="@/assets/images/index/case-list.png" alt="">
                        <div>案例列表</div>
                    </div>
                </div>
            </div>
            <div class="header-section">
                <div class="user-info">
                    <div>你好，admin</div>
                    <img src="@/assets/images/index/head.png" alt="">
                </div>
                <div class="logout" @click="logoutDialog = true">
                    <img src="@/assets/images/index/quit.png" alt="">
                    <div>退出</div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="case-list">
                <div class="case-content" @click="enterCase">
                    <div class="case-info">
                        <img src="@/assets/images/index/plane.png" alt="">
                        <div class="case-title">航班天气因素上座情况预测分析</div>
                    </div>
                    <div class="case-description">
                        作为智能人机交互的关键技术之一，情感智能是人机交互智能化的一个关键部分。在本案例中通过TensorFlow实现循环神经网络模型用于语音情感数据的情感预测。
                    </div>
                </div>
            </div>
        </div>
            <el-dialog
                v-model="logoutDialog"
                title="退出"
                width="30%"
            >
            <span>您确定退出系统吗？</span>
            <template #footer>
            <span class="dialog-footer">
                <el-button @click="logoutDialog = false">取消</el-button>
                <el-button type="primary" @click="logout">确认</el-button>
            </span>
            </template>
        </el-dialog>
    </div>
</template>
<script>
import { reactive, toRefs, inject } from 'vue'
import { useRouter } from 'vue-router'
export default {
    setup() {
        const router = useRouter()
        const Cookies = inject('Cookies')
        const data = reactive({
            logoutDialog: false,
        })

        function enterCase()
        {
            const { href } = router.resolve({
                name: 'case',
            });
            window.open(href, '_blank')
        }

        function logout()
        {
            // localStorage.removeItem('loginToken')
            Cookies.remove('loginToken')
            router.push('/login')
        }

        return {
            ...toRefs(data),
            enterCase,
            logout
        }
    },
}
</script>
<style lang="scss" scoped>
    .index-page {
        width:100%;
        min-height:100vh;
        background: #EAEAEE;
        .header {
            height:80px;
            width:100%;
            min-width:1200px;
            display: flex;
            align-items: center;
            background: #021259;
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding:0px 35px;
            .header-section {
                display: flex;
                align-items: center;
                height:100%;
                .logo {
                    width: 35px;
                    height: 39px;
                    margin-right: 20px;
                }
                .title {
                    font-size: 24px;
                    font-weight: bold;
                    min-width:300px;
                    letter-spacing: 1px;
                }
                .menu-list {
                    margin-left:20px;
                    display: flex;
                    align-items: center;
                    height:100%;
                    .menu-item {
                        display: flex;
                        align-items: center;
                        height: 100%;
                        width: 180px;
                        justify-content: center;
                        cursor: pointer;
                        &.active {
                            background: rgba(0,143,133,0.32);
                        }
                        img {
                            width:28px;
                            height:23px;
                            margin-right:15px;
                        }
                        div {
                            font-size: 18px;
                        }
                    }
                }
                .user-info {
                    display: flex;
                    align-items: center;
                    height:100%;
                    font-size: 18px;
                    margin-right:50px;
                    img {
                        width: 50px;
                        height: 50px;
                        margin-left:20px;
                    }
                }
                .logout {
                    display: flex;
                    align-items: center;
                    height: 100%;
                    font-size: 18px;
                    cursor: pointer;
                    img {
                        width: 19px;
                        height: 21px;
                        margin-right: 5px;
                    }
                }
            }
        }
        .container {
            padding:30px 0px;
            .case-list {
                display: grid;
                width:1200px;
                margin:0 auto;
                grid-template-columns: repeat(auto-fill, 380px);
                grid-template-rows: repeat(auto-fill, 350px);
                grid-gap: 30px 30px;
                .case-content {
                    // width: 380px;
                    // height: 350px;
                    background: #ffffff;
                    cursor: pointer;
                    .case-info {
                        background: #00A0E9;
                        width: 100%;
                        height: 50%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        padding: 40px;
                        img {
                            width: 55px;
                            height: 48px;
                            margin-right: 30px;
                        }
                        .case-title {
                            color: #ffffff;
                            font-size: 24px;
                            line-height: 1.5;
                        }
                    }
                    .case-description {
                        padding: 40px;
                        color: #484848;
                        font-size: 16px;
                        line-height: 1.5;
                    }
                }
            }
        }
    }
</style>